/**
  ******************************************************************************
  * File Name          : route_dk_tonet.c
  * Description        : Code for freertos applications
  ******************************************************************************
  * @attention
  *
  ******************************************************************************
  */

/* Includes ------------------------------------------------------------------*/
#include <string.h>
#include "tskcfg.h"
#include "route.h"
#include "ctrl_common.h"

#if (ROUTE_INTEGRATED > 0)
void Route_dj_tonet_ptstate(void)
{
  Route_PayloadType *proute = NULL;
  
  proute = pvPortMalloc(sizeof(Route_PayloadType));
  if(proute != NULL)
  {
    memset(proute, 0, sizeof(Route_PayloadType));
	
    proute->dev_type  = RT_DV_DK;
    proute->trans_dir = ROUTE_TRSDIR_SUBDEV_TO_NET,
    proute->pl_type   = ROUTE_PLTYP_DK_STATE,
    proute->pl_len    = sizeof(Ctrl_StateDKType);
    
    *((Ctrl_StateDKType *)(proute->payload)) = Ctrl_StateDK;
    
    if(Route_EvewToNet_Qhd != NULL)
    {
      xQueueSend(Route_EvewToNet_Qhd, proute, 0);
    }
  }
  
  vPortFree(proute);
}

void Route_dj_tonet_ptpara(void)
{
  Route_PayloadType *proute = NULL;
  
  proute = pvPortMalloc(sizeof(Route_PayloadType));
  if(proute != NULL)
  {
    memset(proute, 0, sizeof(Route_PayloadType));
	
    proute->dev_type  = RT_DV_DK;
    proute->trans_dir = ROUTE_TRSDIR_SUBDEV_TO_NET,
    proute->pl_type   = ROUTE_PLTYP_DK_PARA,
    proute->pl_len    = sizeof(Ctrl_ParaDKType);
    
    *((Ctrl_ParaDKType *)(proute->payload)) = Ctrl_ParaDK;
    
    if(Route_EvewToNet_Qhd != NULL)
    {
      xQueueSend(Route_EvewToNet_Qhd, proute, 0);
    }
  }
  
  vPortFree(proute);
}
#endif
